//Connect A with B drawing a line, bend the line up or down with bezier depth min -100, max 100
var bezierTo = function(ctx, Ax, Ay, Bx, By, bezierDepth){
	if(bezierDepth){
		var bezierF = bezierDepth * 0.0025;
		if(bezierDepth < 0) var flip = -1;
		else var flip = 1;
	} else{
		var bezierF = 0;
		var flip = 1;
	};
	
	// first bezier point from start point forwards
	var dx = Bx - Ax;
	var dy = By - Ay;
	Vx = bezierF * dx;
	Vy = bezierF * dy;
	
	// the point allong vector
	//var allongSx = Ax + flip * Vx;
	//var allongSy = Ay + flip * Vy;

	// the point besides vector
	var besidesSx = Ax + flip * Vx - bezierF * dy;
	var besidesSy = Ay + flip * Vy + bezierF * dx;

	// second bezier point mirror from end point backwards
	// the point allong vector
	//var allongEx = Bx - flip * Vx;
	//var allongEy = By - flip * Vy;
	
	// the point besides vector
	var besidesEx = Bx - flip * Vx - bezierF * dy;
	var besidesEy = By - flip * Vy + bezierF * dx;

	// draw bezier curve using calculated points
	ctx.beginPath();
	ctx.moveTo(Ax, Ay);
	ctx.bezierCurveTo(besidesSx, besidesSy, besidesEx, besidesEy, Bx, By);
	ctx.stroke();
};
